﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>Index</title>
    <script src="@Url.Content("~/js/jquery.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/js/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/js/jquery.form.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/admin/artDialog/artDialog.js?skin=default")" type="text/javascript"></script>
    <script src="@Url.Content("~/Areas/admin/artDialog/plugins/iframeTools.js")" type="text/javascript"></script>
    <script type="text/javascript">

           jQuery(document).ready(function ($) {

               $('#myform').ajaxForm({
                   dataType: 'json',
                   success: complete  // post-submit callback
               });

           })

           function complete(data) {
               if (data.error == "0") {

                   var file = $("#imgFile");
                   file.after(file.clone().val(""));
                   file.remove();
                   document.getElementById('imgshow').src = data.url;  //显示图片
                   document.getElementById('oldimageurl').value = data.url;  //旧图片
                   art.dialog.data('returnValue', data.url); // 存储数据
               } else {
                   alert(data.message);
               }
           }  

    </script>
</head>
<body>
    <div style=" text-align:center; ">
        <form id="myform" action="@Url.Action("UploadImage", "Upload")" enctype="multipart/form-data" method="post">
        <input id="oldimageurl" name="oldimageurl" type="hidden" />
        <input id="id" name="id" type="hidden" />
        <input type="file" id="imgFile" name="imgFile" class="file  large"></input>&nbsp;&nbsp;<input type="submit" value="上传" />
        </form>

        <img id="imgshow" width="150" height="150" />

    </div>
</body>
</html>
